#ifndef SKUPROPERTY_H_
#define SKUPROPERTY_H_

#pragma once
#include <string>
#include <vector>
#include <map>
#include <WinSock2.h>
class SkuProperty
{
public:
	SkuProperty(void);
	~SkuProperty(void);
	std::string name;
	std::map<std::string, std::string> codeDesc;
};
class B5mSku
{
public:
	std::string price;
	std::string properties_name;
	std::string quantity;
	std::string sku_id;
	std::string imgUrl;
	std::string smallImgUrl;
	std::string getJson();
};
class B5mSkuTaskResp{
public:
	std::string url;
	bool offline;
	float price;
	std::vector<B5mSku> skus;
	std::string getJson();
};
class B5mSkuTask{
public:
	B5mSkuTask(void);
	std::string url;
	std::string htmltext;
	std::vector<std::string> type;
	bool needCookie;
	std::string cookie;
	std::string cookieUrl;
	std::string referer;
	std::map<std::string, std::string> realPrice;
	std::map<std::string, std::string> realStock;
	bool isTerminated;
	std::vector<SkuProperty> getSkuProperties();
	std::map<std::string, std::string> getCodeImgurl();
	B5mSkuTaskResp getB5mSkuTaskResp();
	void getRealPrice();

};
class skuUtil{
private:
	static std::string host;
	static int port;
public:
	static SOCKET connectSocket();
	static std::string postMsg(std::string, const int,SOCKET sockClient);
	static std::string GBKToUTF8(const std::string& strGBK); 
	static SOCKET sockClient;
	static const int SENDURL=1;
	static const int GETTASK=2;
	static const int SUBMITSKU=3;
};

#endif // SKUPROPERTY_H_
